import { terser } from 'rollup-plugin-terser'
import replace from '@rollup/plugin-replace'

import baseConfig from './rollup.config'

const umdConfig = {
	...baseConfig,
	output: [
		{
			name: 'Vntd',
			file: 'dist/index.umd.js',
			format: 'umd',
			exports: 'named',
			globals: {
				react: 'React',
				'react-dom': 'ReactDOM',
				'axios': 'Axios'
			},
			plugins: [terser()]
		}
	],
	plugins: [
		replace({
			'process.env.NODE_ENV': JSON.stringify('production'),
			preventAssignment: true
		}),
		...baseConfig.plugins
	],
	external: ['react', 'react-dom', 'axios']
}

export default umdConfig
